<template>
	<view>
		<u-sticky bgColor="#fff">
			<view class="mainpadding" style="background-color: #fea23d;">
				<view class="xiaobai ershiba">{{$t('dingdanmx.ljsy')}}{{allMoney}}{{$t('dingdanmx.y')}}</view>
			</view>
			<u-tabs :list="list1" lineColor="#fea23d" @click="changetab" :scrollable="false" :activeStyle="{
				    color: '#000000',
				    fontWeight: 'bold',
				    transform: 'scale(1.05)'
				}" :inactiveStyle="{
				            color: '#666666',
							fontWeight: '500',
				            transform: 'scale(1)'
				        }" itemStyle="height: 44px;"></u-tabs>
		</u-sticky>
		<view class="mainpadding_top ffffff" v-for="(item,index) in list" :key="index">
			<view class="flexbetween xiahuaxian">
				<view class="flexleft">
					<image :src="item.userInfo.avatar" class="margin_right3"
						style="width: 50rpx;height: 50rpx;border-radius: 50%;" mode=""></image>
					<view class="ershiba xiaohei">{{item.userInfo.nickname}}</view>
				</view>
				<view class="xiaolv ershiba" v-if="item.orderStatusText == 2">{{$t('dingdanmx.yfk')}}</view>
				<view class="xiaolv ershiba" v-if="item.orderStatusText == 4">{{$t('dingdanmx.ywc')}}</view>
			</view>
			<view class="flexbetween xiahuaxian margin_top" v-for="ite in item.goodsList" :key="ite.id">
				<view class="flexleft">
					<image :src="ite.picUrl" class="margin_right3" style="width: 100rpx;height: 100rpx;"
						mode=""></image>
					<view class="ershiba xiaohei">{{ite.goodsName}}</view>
				</view>
				<view class="ershiba xiaohui">{{$t('dingdanmx.yj')}}+{{item.actualPrice}}</view>
			</view>
			<view class="xiahuaxian">
				<view class="margin_top2 xiaohui ershil">{{$t('dingdanmx.fxdj')}}：{{item.level}}</view>
				<view class="margin_top2 xiaohui ershil">{{$t('dingdanmx.ddbh')}}：{{item.orderSn}}</view>
				<view class="margin_top2 xiaohui ershil">{{$t('dingdanmx.xdsj')}}：{{item.creadTime}}</view>
			</view>
			<view class="flexright xiaohei margin_top2 sanshier">{{$t('dingdanmx.yjyj')}}：+{{item.actualPrice}}</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				list1: [{
						name: this.$t('dingdanmx.qb'),
						id: "0"
					}, {
						name: this.$t('dingdanmx.yfk'),
						id: "2"
					},
					{
						name: this.$t('dingdanmx.ywc'),
						id: "4"
					}
				],
				categoryId: "0",
				allMoney: {},
				list: []
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			changetab(e) {
				this.categoryId = e.id
				this.init()
			},
			init() {
				httpRequest.request('/wx/spreader/spreaderOrder', 'GET', {
					status: this.categoryId,
					page: 0,
					size: 1000
				}).then(res => {
					let total = 0
					if (res.data.length > 0) {
						for (var i = 0; i < res.data.length; i++) {
							total += parseFloat((res.data[i].actualPrice).toFixed(2));
						}
					}
					this.list = res.data
					this.allMoney = parseFloat(total.toFixed(2))
				})
			},
		}
	}
</script>

<style>

</style>